package com.xunlai.infra.permission.manager.authority.sercurity.jackson;

import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.xunlai.infra.permission.common.security.TenantUser;
import org.springframework.security.jackson2.SecurityJackson2Modules;

/**
 * @author liang
 * @date 12/8/22 8:29 PM
 */
public class TenantUserJackson2Module extends SimpleModule {

    public TenantUserJackson2Module() {
        super(TenantUserJackson2Module.class.getName(), new Version(1, 0, 0, null, null, null));
    }

    @Override
    public void setupModule(SetupContext context) {
        SecurityJackson2Modules.enableDefaultTyping(context.getOwner());
        context.setMixInAnnotations(TenantUser.class, TenantUserMixin.class);
    }
}
